@extends ('layouts/app')

@section('content')
<div class="weui-cells topic">
    <a class="weui-cell weui-cell_access" href="/mobile/address">
        <div class="weui-cell__bd">
            <p>地址</p>
        </div>
        <div class="weui-cell__ft"></div>
    </a>
    <a class="weui-cell weui-cell_access" href="/mobile/confirm">
        <div class="weui-cell__bd">
            <p>设置支付密码</p>
        </div>
        <div class="weui-cell__ft"></div>
    </a>
    <a class="weui-cell weui-cell_access" href="/mobile/password">
        <div class="weui-cell__bd">
            <p>修改登录密码</p>
        </div>
        <div class="weui-cell__ft"></div>
    </a>
    <a class="weui-cell weui-cell_access" href="/mobile/realname">
        <div class="weui-cell__bd">
            <p>实名认证</p>
        </div>
        <div class="weui-cell__ft"></div>
    </a>
</div>
<div class=" weui-cells_form">
    <div class="weui-cell weui-cell_switch">
        <div class="weui-cell__bd">WIFI连接时自动播放视频</div>
        <div class="weui-cell__ft">
            <input class="weui-switch" type="checkbox">
        </div>
        <div class="weui-cell__ft"></div>
    </div>
</div>
<div class="weui-cells topic">
    <a class="weui-cell weui-cell_access install" href="javascript:;">
        <div class="weui-cell__bd">
            <p>清除缓存</p>
        </div>
        <div class="weui-cell__ft alert"></div>
    </a>
    <a class="weui-cell weui-cell_access" href="/mobile/contact">
        <div class="weui-cell__bd">
            <p >隐私权限</p>
        </div>
        <div class="weui-cell__ft"></div>
    </a>
    <a class="weui-cell weui-cell_access logout">

        <div class="weui-cell__bd">
            <p>退出登录</p>
        </div>
        <div class="weui-cell__ft"></div>
    </a>

</div>
<script>
    //获得缓存数据大小
    $(document).ready(function () {
        var data = Storage.getSize();
        $(".alert").text(data);
        console.log("Storage", Storage.preId);
        {{--install赋值点击事件--}}
        $(".install").click(function(){
            var text =  $(".alert").text();
            if (text == "0 KB" || text == "0B") {
                return;
            }
            console.log("确认");
            //alert 点击是否确认  function执行
            $.alert("清除缓存会把购物车也一直清空，请谨慎操作！",function(){
                Storage.removeAllItem();
                $.toast("清除成功");
                $(".alert").text("0 KB")
            });
        });

    });
    // 点击退出登录
    $(".logout").click(function () {
        $.get("/logout", {}, function (res) {
            console.log("res111", res);
            Storage.remove("userInfo");
            location.href = "/login"
        })
    });

</script>
@endsection
